
public class TestMediator {

    public static void main(String[] args) {
        AbstractMediator registerCenter = new RegisterCenter();

        ServiceA serviceA = new ServiceA(registerCenter);
        ServiceB serviceB = new ServiceB(registerCenter);

        registerCenter.setServiceA(serviceA);
        registerCenter.setServiceB(serviceB);

        serviceA.callB();
        System.out.println("----------------");
        serviceB.callA();
    }
}